<!DOCTYPE html>
<html>
  
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  <meta name="author" content="Amos Zhu">
  
  
  <title>Redis教程（四）——配置高可用和集群 | Amos的技术博客</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  
    <meta name="keywords" content="redis,centos7,redis,">
  

  
  <meta name="description" content="在生产环境中，Redis单实例远远不能提供稳定高效，具备数据冗余和高可用的服务。所以今天我们来整理下，如何使用哨兵来搭建Redis服务端的高可用和集群">

  

  
    <script src="//cdn.jsdelivr.net/npm/leancloud-storage@3.11.1/dist/av-min.js" async></script>
  

  
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
  

  
    <script src="//unpkg.com/valine/dist/Valine.min.js" async></script>
  

  

  <script>
  // theme-ad's config script
  // it can be used in every script
  
  window.AD_CONFIG = {
    leancloud: {"appid":"eObxCkTJ6j4GzRxGLgiHyfJa-gzGzoHsz","appkey":"fzRMAFC6MCE11mp7mnvh4Kwe","comment":true,"count":true},
    welcome: {"enable":true,"interval":30},
    start_time: "2019-05-28",
    passwords: ["efe07af7441da2b69c4a41e42e73be4db47f66010a56900788a458354a7373ec", ],
    is_post: true,
    lock: false,
    author: "Amos Zhu",
    share: {"qq":true,"wechat":true},
    mathjax: true,
    page_type: "",
    root: "/blog/"
  };
</script>

  <script src="/blog/vendor/sha256.min.js"></script>
<script src="/blog/js/auth.js"></script>
<script src="/blog/js/index.js"></script>
<script src="/blog/vendor/qrcode.min.js"></script>

  
    <link rel="icon" href="/blog/images/favicon.ico">
    <link rel="apple-touch-icon" href="/blog/images/touch-icon.png">
  

  <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

  <link rel="stylesheet" href="/blog/css/index.css">
<link rel="stylesheet" href="/blog/styles/components/highlight/highlight.css">

  
</head>
  <body>
    <header class="site-header">
  <div class="site-header-brand">
    
      <span class="site-header-brand-title">
        <a href="/blog/">Amos Zhu</a>
      </span>
    
    
      <span class="site-header-brand-motto"> | 当浮躁的心静不下，不妨写些东西或者看会书</span>
    
  </div>
  <div class="site-header-right">
    <nav class="site-header-navigation">
      
        <a href="/blog/" target="_self">首页</a>
      
        <a href="/blog/archives/" target="_self">归档</a>
      
        <a href="/blog/tags/" target="_self">标签</a>
      
        <a href="/blog/categories/" target="_self">分类</a>
      
        <a href="/blog/redis/" target="_self">redis</a>
      
        <a href="/blog/rabbitMQ/" target="_self">rabbitMQ</a>
      
        <a href="/blog/elasticsearch" target="_self">elasticsearch</a>
      
        <a href="/blog/stuff" target="_self">stuff</a>
      
        <a href="/blog/kafka" target="_self">kafka</a>
      
        <a href="/blog/friends/" target="_self">友链</a>
      
        <a href="/blog/about/" target="_self">关于</a>
      
    </nav>
    <div class="site-header-btn">
      
        <a href="https://gitee.com/amos_zhu" target="_blank" id="site-github">
          <i class="fa fa-github-alt"></i>
        </a>
      
      <a href="javascript:void(0);" id="site-search">
        <i class="fa fa-search"></i>
      </a>
      <a href="javascript:void(0);" id="site-nav-btn">
        <i class="fa fa-ellipsis-v"></i>
      </a>
    </div>
  </div>
</header>
<nav class="table-content" id="site-nav">
  <div class="table-content-title">
    <span>导航</span>
  </div>
  <div class="table-content-main">
    <ol class="toc">
      
        <li class="toc-item">
          <a href="/blog/" target="_self">
            首页
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/archives/" target="_self">
            归档
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/tags/" target="_self">
            标签
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/categories/" target="_self">
            分类
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/redis/" target="_self">
            redis
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/rabbitMQ/" target="_self">
            rabbitMQ
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/elasticsearch" target="_self">
            elasticsearch
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/stuff" target="_self">
            stuff
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/kafka" target="_self">
            kafka
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/friends/" target="_self">
            友链
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/about/" target="_self">
            关于
          </a>
        </li>
      
    </ol>
  </div>
</nav>
<div id="site-process"></div>
    <main>
      
  <div class="passage">
  <div class="passage-meta">
    <span>
      <i class="fa fa-calendar"></i>2019-06-18
    </span>
    
      <span>
        | <a href="/blog/categories/redis/"><i class="fa fa-bookmark"></i>redis</a>
      </span>
    
    
      <span>
        | <i class="fa fa-unlock-alt"></i>UNLOCK
      </span>
    
  </div>
  <h1 class="passage-title">
    Redis教程（四）——配置高可用和集群
  </h1>
  
  <article class="passage-article">
    <br>在搭建高可用和集群前，我们先要带着如下的问题来学习<p></p>
<ul>
<li>什么是Redis的高可用</li>
<li>Redis高可用需要达到哪些要求</li>
<li>什么是哨兵？有哪些作用</li>
<li>如何配置哨兵</li>
<li>哨兵的原理以及数据的管理问题</li>
</ul>
<h2 id="Redis高可用"><a href="#Redis高可用" class="headerlink" title="Redis高可用"></a>Redis高可用</h2><p>单机版的Redis的主从复制和持久化我们解决了Redis数据冗余备份和读写QPS10+的访问请求，但是在生产环境中，访问量达到几百万甚至几千万的访问量，这样的情况下，怎么保证系统能够稳定持续的向外输出服务，如果在服务运行期间，发生了Redis节点宕机或Jvm进程内存溢出或cpu打满或磁盘满等其他原因导致服务崩溃，要怎么保证其他的服务能代替主服务继续对外提供服务。</p>
<p>我们将系统能在99.99%的时间里，都是处于可用状态的，能成功的对外提供服务的称为高可用，也称四九可用</p>
<p>在Redis中，我们可以通过Redis的哨兵来搭建Redis的高可用集群环境，我们先来认识下Redis的哨兵</p>
<h2 id="Redis哨兵-Sentinel"><a href="#Redis哨兵-Sentinel" class="headerlink" title="Redis哨兵(Sentinel)"></a>Redis哨兵(Sentinel)</h2><p>顾名思义Sentinel充当了Redis主从实例的守卫者，是构成Redis高可用的一个重要组成部分，其主要作用如下：</p>
<ul>
<li>集群监控，负责监控redis master和slave进程是否正常工作</li>
<li>消息通知，如果某个redis实例有故障，那么哨兵负责发送消息作为报警通知给管理员</li>
<li>故障转移，如果master node挂掉了，会自动转移到slave node上</li>
<li>配置中心，如果故障转移发生了，通知client客户端新的master地址</li>
</ul>
<p>Redis sentinel本身也是分布式的，作为一个哨兵集群去运行，互相协同工作</p>
<h3 id="Redis-sentinel"><a href="#Redis-sentinel" class="headerlink" title="Redis sentinel"></a>Redis sentinel</h3><p>由于哨兵本身也是可能失效的，所以一个哨兵不能保证Redis服务的高可用，为了保证Redis服务其中一个节点故障的，其他节点仍能够继续推选新的节点来代替当前故障节点继续对外提供服务，Redis通过仲裁算法来推选新的节点来代替当前故障节点。所以哨兵至少需要三个实例来完成高可用，才是一个健壮的哨兵系统</p>
<ul>
<li>哨兵至少需要3个实例，来保证自己的健壮性</li>
<li>哨兵 + redis主从的部署架构，是不会保证数据零丢失的，只能保证redis集群的高可用性</li>
<li>对于哨兵 + redis主从这种复杂的部署架构，尽量在测试环境和生产环境，都进行充足的测试和演练</li>
</ul>
<p>为什么redis哨兵集群只有2个节点无法正常工作？</p>
<p>这里我们要先知道一个概念<code>quorum</code>,如果部署了2个节点那么 quorum=1,同时还是需要<code>majority</code>，也就是大多数哨兵都是运行的。<br>比如我们现在有两个服务器分别运行了 M1和S1  M2和S2的服务实例，如下图所示：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">+----+         +----+</span><br><span class="line">| M1 |---------| M2 |</span><br><span class="line">| S1 |         | S2 |</span><br><span class="line">+----+         +----+</span><br></pre></td></tr></table></figure></p>
<p>其中M1和S1服务不可对外提供服务了，则哨兵只剩一个了，此时就没有<code>majority</code>来允许故障进行转移了，故障转移不成功，则就不是高可用。</p>
<p>三个哨兵模式是最经典的哨兵模式<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">       +----+</span><br><span class="line">       | M1 |</span><br><span class="line">       | S1 |</span><br><span class="line">       +----+</span><br><span class="line">          |</span><br><span class="line">+----+    |    +----+</span><br><span class="line">| R2 |----+----| R3 |</span><br><span class="line">| S2 |         | S3 |</span><br><span class="line">+----+         +----+</span><br></pre></td></tr></table></figure></p>
<p>此时，如果M1宕机了，那么哨兵还剩下2个，如果剩下的两个一致任务M1宕机了，此时就会通过仲裁机制算法，重新推举新的节点来代替M1的位置，继续对外提供服务</p>
<h2 id="Redis-sentinel哨兵的搭建"><a href="#Redis-sentinel哨兵的搭建" class="headerlink" title="Redis sentinel哨兵的搭建"></a>Redis sentinel哨兵的搭建</h2><p>我们准备了几个环境，来搭建上述的经典的三实例节点的哨兵集群环境，配置如下</p>
<h3 id="Redis-角色分配"><a href="#Redis-角色分配" class="headerlink" title="Redis 角色分配"></a>Redis 角色分配</h3><table>
<thead>
<tr>
<th>角色</th>
<th>IP</th>
<th>PORT</th>
</tr>
</thead>
<tbody>
<tr>
<td> Master</td>
<td>192.168.56.105</td>
<td>7000</td>
</tr>
<tr>
<td> Slave1</td>
<td>192.168.56.106</td>
<td>7000</td>
</tr>
<tr>
<td> Slave2</td>
<td>192.168.56.107</td>
<td>7000</td>
</tr>
<tr>
<td> Sentinel1</td>
<td>192.168.56.105</td>
<td>26379</td>
</tr>
<tr>
<td> Sentinel2</td>
<td>192.168.56.106</td>
<td>26379</td>
</tr>
<tr>
<td> Sentinel3</td>
<td>192.168.56.107</td>
<td>26379</td>
</tr>
</tbody>
</table>
<h3 id="Redis-哨兵环境搭建"><a href="#Redis-哨兵环境搭建" class="headerlink" title="Redis 哨兵环境搭建"></a>Redis 哨兵环境搭建</h3><ol>
<li>在redis的安装目录下，有一个sentinel.conf文件，该配置文件主要是用来配置哨兵的相关信息</li>
<li>按照我们之前规划的redis的角色分配，按照之前《<a href="http://localhost:4000/blog/passages/Redis教程（一）——Redis安装/" target="_blank" rel="noopener">redis安装</a>》教程，分别搭建Master和Slave1以及Slave2的redis环境</li>
<li><p>在sentinel.conf中设置如下的相关信息</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">    ## 哨兵的端口</span><br><span class="line">    port 26379</span><br><span class="line">    bind 192.168.56.105</span><br><span class="line">    ## 是否后台启动  按需求配置，本次教程因为是演示，所以没有开启</span><br><span class="line">    daemonize no</span><br><span class="line">    ## 哨兵的输出日志</span><br><span class="line">    logfile /var/run/log/sentinel.log</span><br><span class="line">    ## 哨兵的运行日志</span><br><span class="line">    dir /var/run/log</span><br><span class="line">    ## 将新的主实例添加到sentinel中进行监控</span><br><span class="line">    ## quorum 同意主实例不可达的最少哨兵数</span><br><span class="line">    ## sentinel monitor &lt;master-name&gt; &lt;ip&gt; &lt;redis-port&gt; &lt;quorum&gt;</span><br><span class="line">告诉sentinel去监听地址为ip:port的一个master，这里的master-name可以自定义，quorum是一个数字，指明当有多少个sentinel认为一个master失效时，master才算真正失效</span><br><span class="line">    sentinel monitor mymaster 192.168.56.105 7000 2</span><br><span class="line">    ## 标记实例下线前不可达的最长毫秒数 这里设置需要谨慎，否则超时很容易造成</span><br><span class="line">    ## NOGOODSLAVE No suitable replica to promote</span><br><span class="line">    sentinel down-after-milliseconds mymaster 3000</span><br><span class="line">    ## 几个从实例可以同时从主实例进行数据同步</span><br><span class="line">    sentinel parallel-syncs mymaster 1</span><br></pre></td></tr></table></figure>
</li>
<li><p>配置好sentinel.conf后，同时给予sentinel.conf读写的权限，我们使用命令来启动sentinel</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod -R 777 ../sentinel.conf</span><br><span class="line">redis-server ../sentinel.conf --sentinel</span><br></pre></td></tr></table></figure>
</li>
<li><p>启动完成之后，新开一个ssh通道，打开哨兵的客户端</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">## 进入哨兵的客户端</span><br><span class="line">redis-cli -p 26379</span><br><span class="line">## 然后执行 info sentinel, 返回结果如下</span><br><span class="line"># Sentinel</span><br><span class="line">sentinel_masters:1</span><br><span class="line">sentinel_tilt:0</span><br><span class="line">sentinel_running_scripts:0</span><br><span class="line">sentinel_scripts_queue_length:0</span><br><span class="line">sentinel_simulate_failure_flags:0</span><br><span class="line">master0:name=mymaster,status=ok,address=127.0.0.1:7000,slaves=1,sentinels=1</span><br></pre></td></tr></table></figure>
</li>
<li><p>按照上述的配置，只需要修改bind和monitor对应的IP即可，分别配置好其他服务器上的sentinel的实例</p>
</li>
</ol>
<p>总结：哨兵之间会互相发现</p>
<h3 id="Redis哨兵测试"><a href="#Redis哨兵测试" class="headerlink" title="Redis哨兵测试"></a>Redis哨兵测试</h3><p>至此Redis的哨兵环境就搭建完成了，总的来说很简单，主要理解其中sentinel.conf配置文件中的几个重要的配置项即可，我们来简单测试；<br>目前master是105 7000端口，我们手动将7000端口对应的进程杀掉，强行提示redis 7000的服务实例<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">## 查看7000对应的进程pid</span><br><span class="line">lsof -i:7000</span><br><span class="line">## 杀死7000对应的进程</span><br><span class="line">kill -9 980</span><br></pre></td></tr></table></figure></p>
<p>等一段时间，这个时间主要是由<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">## Redis哨兵可能出现的问题</span><br><span class="line">### Redis异步复制</span><br><span class="line">什么是异步复制？</span><br><span class="line"></span><br><span class="line">因为master -&gt; slave的复制是异步的，所以可能有部分数据还没复制到slave，master就宕机了，此时这些部分数据就丢失了</span><br><span class="line"></span><br><span class="line">### Redis 脑裂</span><br><span class="line">什么脑裂？</span><br><span class="line"></span><br><span class="line">脑裂，也就是说，某个master所在机器突然脱离了正常的网络，跟其他slave机器不能连接，但是实际上master还运行着</span><br><span class="line"></span><br><span class="line">此时哨兵可能就会认为master宕机了，然后开启选举，将其他slave切换成了master</span><br><span class="line"></span><br><span class="line">这个时候，集群里就会有两个master，也就是所谓的脑裂</span><br><span class="line"></span><br><span class="line">此时虽然某个slave被切换成了master，但是可能client还没来得及切换到新的master，还继续写向旧master的数据可能也丢失了</span><br><span class="line"></span><br><span class="line">因此旧master再次恢复的时候，会被作为一个slave挂到新的master上去，自己的数据会清空，重新从新的master复制数据</span><br><span class="line"></span><br><span class="line">Redis对此的解决方法是,通过配置项参数```min-slaves-max-lag```和```min-slaves-to-write</span><br></pre></td></tr></table></figure></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">## 要求至少有1个slave，数据复制和同步的延迟不能超过10秒</span><br><span class="line">min-slaves-to-write 1</span><br><span class="line">min-slaves-max-lag 10</span><br></pre></td></tr></table></figure>
<p>作用：</p>
<ol>
<li>有了min-slaves-max-lag这个配置，就可以确保说，一旦slave复制数据和ack延时太长，就认为可能master宕机后损失的数据太多了，那么就拒绝写请求，这样可以把master宕机时由于部分数据未同步到slave导致的数据丢失降低的可控范围内</li>
<li>如果一个master出现了脑裂，跟其他slave丢了连接，那么上面两个配置可以确保说，如果不能继续给指定数量的slave发送数据，而且slave超过10秒没有给自己ack消息，那么就直接拒绝客户端的写请求，这样脑裂后的旧master就不会接受client的新数据，也就避免了数据丢失</li>
</ol>
  </article>
  <aside class="table-content" id="site-toc">
  <div class="table-content-title">
    <i class="fa fa-arrow-right fa-lg" id="site-toc-hide-btn"></i>
    <span>目录</span>
  </div>
  <div class="table-content-main">
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Redis高可用"><span class="toc-text">Redis高可用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Redis哨兵-Sentinel"><span class="toc-text">Redis哨兵(Sentinel)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Redis-sentinel"><span class="toc-text">Redis sentinel</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Redis-sentinel哨兵的搭建"><span class="toc-text">Redis sentinel哨兵的搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Redis-角色分配"><span class="toc-text">Redis 角色分配</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Redis-哨兵环境搭建"><span class="toc-text">Redis 哨兵环境搭建</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Redis哨兵测试"><span class="toc-text">Redis哨兵测试</span></a></li></ol></li></ol>
  </div>
</aside>
  
    <aside class="passage-copyright">
      <div>本文作者: Amos Zhu</div>
      
        <div>
          原文链接: 
          <a href target="_blank">http://amos_zhu.gitee.io/passages/Redis教程（四）——配置高可用和集群/</a>
        </div>
      
      <div>
        版权声明: 本博客所有文章除特别声明外, 均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议. 转载请注明出处!
      </div>
    </aside>
  
  
    <div class="passage-tags">
     
      <a href="/blog/tags/centos7/"><i class="fa fa-tags"></i>centos7</a>
     
      <a href="/blog/tags/redis/"><i class="fa fa-tags"></i>redis</a>
    
    </div>
  
</div>

    </main>
    
      
<div class="site-comment-contanier" data-plateform="leancloud">
  
    <p id="site-comment-info">
      <i class="fa fa-spinner fa-spin"></i> 评论加载中
    </p>
    <div id="site-comment"></div>
  
</div>
    
    <div class="site-footer-wrapper">
  <footer class="site-footer">
    
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">博客推荐</h5>
          
            <span class="site-footer-item">
              <a href="http://youzhixueyuan.com/series/java" target="_blank">优知学院</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://ruanyifeng.com/" target="_blank">阮一峰的个人网站</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">系列教程</h5>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/redis" target="_blank">Redis系列教程</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/rabbitMQ/" target="_blank">RabbitMQ教程</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/kafka/" target="_blank">Kafka架构探险</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">抓到我</h5>
          
            <span class="site-footer-item">
              <a href="https://gitee.com/amos_zhu" target="_blank">Gitee</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://blog.csdn.net/wdcl2468" target="_blank">CSDN</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://www.jianshu.com/u/2dbe61b1f3c3" target="_blank">简书</a>
            </span>
          
        </div>
      
    
    <div class="site-footer-info">
      <i class="fa fa-clock-o"></i> 本站已稳定运行<span id="site-time"></span>
    </div>
    
      <div class="site-footer-info">
        <i class="fa fa-paw"></i> 您是本站第 <span id="site-count"></span> 位访客
      </div>
    
    
      <div class="site-footer-info">
        <i class="fa fa-at"></i> Email: amoszhu@aliyun.com
      </div>
    
    <div class="site-footer-info">
      <i class="fa fa-copyright"></i> 
      2019 <a href="https://github.com/dongyuanxin/theme-ad/" target="_blank">Theme-AD</a>.
      Created by <a href="https://godbmw.com/" target="_blank">GodBMW</a>.
      All rights reserved.
    </div>
  </footer>
</div>
    <div id="site-layer" style="display:none;">
  <div class="site-layer-content">
    <div class="site-layer-header">
      <span class="site-layer-header-title" id="site-layer-title"></span>
      <i class="fa fa-close" id="site-layer-close"></i>
    </div>
    <div class="site-layer-body" id="site-layer-container">
      <div class="site-layer-input" id="site-layer-search" style="display: none;">
        <div class="site-layer-input-choose">
          <a href="javascript:void(0);" title="Change Search Engine">Google</a>
        </div>
        <input type="text">
        <i class="fa fa-search"></i>
      </div>
      
        <div class="site-layer-reward" id="site-layer-reward" style="display: none;">
          
            <div>
              <img src="/blog/images/wechat.png" alt="WeChat">
              
                <p>WeChat</p>
              
            </div>
          
            <div>
              <img src="/blog/images/alipay.png" alt="AliPay">
              
                <p>AliPay</p>
              
            </div>
          
        </div>
      
      <div id="site-layer-welcome" style="display:none;"></div>
    </div>
  </div>
</div>
    

<div class="bottom-bar">
  <div class="bottom-bar-left">
    <a href="/blog/passages/Redis教程（五）——RedisCluster配置/" data-enable="true">
      <i class="fa fa-arrow-left"></i>
    </a>
    <a href="/blog/passages/Redis教程（三）——Redis的主从复制/" data-enable="true">
      <i class="fa fa-arrow-right"></i>
    </a>
  </div>
  <div class="bottom-bar-right">
    <a href="javascript:void(0);" data-enable="true" id="site-toc-show-btn">
      <i class="fa fa-bars"></i>
    </a>
    
      <a href="#site-comment" data-enable="true">
        <i class="fa fa-commenting"></i>
      </a>
    
    <a href="javascript:void(0);" id="site-toggle-share-btn">
      <i class="fa fa-share-alt"></i>
    </a>
    
      <a href="javascript:void(0);" id="site-reward">
        <i class="fa fa-thumbs-up"></i>
      </a>
    
    <a href="javascript:void(0);" id="back-top-btn">
      <i class="fa fa-chevron-up"></i>
    </a>
  </div>
</div>
    <div id="share-btn">
  
  
  
  
    <a id="share-btn-qq" href="javascript:void(0);" target="_blank">
      <i class="fa fa-qq"></i>
    </a>
  
  
    <a id="share-btn-wechat" href="javascript:void(0);" target="_blank">
      <i class="fa fa-wechat"></i>
    </a>
  
</div>
    


  <script async>
  (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      if (curProtocol === 'https') {
          bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
      }
      else {
          bp.src = 'http://push.zhanzhang.baidu.com/push.js';
      }
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
  })();
  </script>



  <script async>
    (function(){
    var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?":"https://jspassport.ssl.qhimg.com/11.0.1.js?";
    document.write('<script src="' + src + '" id="sozz"><\/script>');
    })();
  </script>


    
  </body>
</html>